﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ScriptEngine.Web.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="contentContainer">
        <table>
            <tr>
                <td>
                    <asp:TextBox ID="txtCode" runat="server" TextMode="MultiLine" style="height:400px;width:790px;"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btn" runat="server" OnClick="btn_Click" Text="Salva" style="width:790px;"/>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="gvScripts" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        DataSourceID="ScriptSource" DataKeyNames="Id" Width="600px">
                        <Columns>
                            <asp:CommandField ShowDeleteButton="True" />
                            <asp:TemplateField HeaderText="Id" SortExpression="Id">
                                <ItemTemplate>
                                    <asp:Label ID="lblId" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ScriptCode" HeaderText="ScriptCode" SortExpression="ScriptCode" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:HiddenField ID="hId" runat="server" Value='<%# Eval("Id") %>'></asp:HiddenField>
                                    <asp:Button ID="btnExec" runat="server" OnClick="btnExec_Click" Text="Esegui" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ScriptSource" runat="server" DataObjectTypeName="ScriptEngine.Script"
                        DeleteMethod="Delete" InsertMethod="Create" SelectMethod="ReadAll" TypeName="ScriptEngine.ScriptDataSource"
                        UpdateMethod="Update"></asp:ObjectDataSource>
                </td>

            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblResult" runat="server" ></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
